
// export default function MapLoader() {
//   return new Promise((resolve, reject) => {
//     if (window.AMap) {
//       resolve(window.AMap);
//     } else {
// 		var script = document.createElement('script');
// 		 script.type = "text/javascript";
// 		 script.async = true;
// 		script.src = "https://webapi.amap.com/maps?v=1.4.15&key=9bc3617acf216e0ae180be8a7370a800&callback=initAMap";
// 		script.onerror = reject;
// 		  document.head.appendChild(script);
//     }
//     window.initAMap  = () => {
//       resolve(window.AMap);
//     };
//    })
//   }
  
  export function myAMap() {
  	return new Promise(function(resolve, reject) {
  		if (typeof window.onLoadMyAMap === 'function') {
  			resolve(window.onLoadMyAMap)
  			return
  		}
  		window.onLoadMyAMap = function() {
  			resolve(window.onLoadMyAMap)
  		}
  		window._AMapSecurityConfig = {
  			securityJsCode: '2134097c15b139179dfd25c94b635805',
  		};
  		var script = document.createElement('script')
  		script.type = 'text/javascript'
  		script.src =
  			`https://webapi.amap.com/maps?v=2.0&key=9bc3617acf216e0ae180be8a7370a800&callback=onLoadMyAMap&plugin=AMap.Geocoder,AMap.AutoComplete,AMap.PlaceSearch`
  		script.onerror = reject
  		document.head.appendChild(script)
  	})
  }

